/**
 * Alipay.com Inc.
 * Copyright (c) 2004-2018 All Rights Reserved.
 */
package com.antcloud.demo.antscheduler;

import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

/**
 *
 * @author qian.lqlq
 * @version $Id: CmdHandler.java, v 0.1 2018年09月10日 00:39 qian.lqlq Exp $
 */
public class CmdHandler extends TextWebSocketHandler {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Override
    public void handleTextMessage(WebSocketSession session, TextMessage message) {
        TextMessage msg = new TextMessage("Hello, " + message.getPayload() + "!");

        logger.info("message received: {}", message.getPayload());
        try {
            session.sendMessage(msg);
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}